import xlrd

def  writeIn(require_need_col):

    book = ''
    #读取文件
    try:
        book = xlrd.open_workbook('/home/zyq/文档/历史3月2.xls')
    except FileNotFoundError:
        book = xlrd.open_workbook('/home/zyq/文档/P/docs/历史3月2（复件）.xls')

    print('sheet页名称:',book.sheet_names())
    sheet1 = book.sheet_by_index(0)
    nrows = sheet1.nrows
    ncols = sheet1.ncols
    print("作业查询程序")

    #获取所需数据(行)
    col2 = sheet1.col_values(1)


    #require_need_col = int(require_need_col)
    #require_need_col = 9
    real_data = require_need_col + 2

    #print(real_data)
    #print(require_need)
    col1 = sheet1.col_values(real_data)

    #计数&定位
    count = -1

    s_n = []
    for i in col1:
        #print(i)
        count = count + 1
        #require_need_row = count 
        #print(require_need_row)
        if i != '√':
            name = col2[count]
               
            s_n.append(name)
            global name_list
            name_list = []
            name_list = name_list + s_n

    print("今日作业未交：",name_list)
    return name_list

#writeIn(require_need_col=12)
